Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-trim-spaces-only

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-trim-spaces-only

Like String.trim() but you can choose granularly what to trim

  • 4.1.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is string-trim-spaces-only?

The string-trim-spaces-only npm package is a utility for trimming spaces from strings. It focuses on removing only the leading and trailing spaces, leaving the inner spaces intact.

What are string-trim-spaces-only's main functionalities?

Trim leading and trailing spaces

This feature removes the leading and trailing spaces from a string, but keeps the spaces between words intact.

const trimSpaces = require('string-trim-spaces-only');
const result = trimSpaces('  Hello World  ');
console.log(result); // 'Hello World'

Trim leading spaces only

This feature removes only the leading spaces from a string, leaving the trailing spaces and inner spaces intact.

const trimSpaces = require('string-trim-spaces-only');
const result = trimSpaces('  Hello World  ', { leading: true, trailing: false });
console.log(result); // 'Hello World  '

Trim trailing spaces only

This feature removes only the trailing spaces from a string, leaving the leading spaces and inner spaces intact.

const trimSpaces = require('string-trim-spaces-only');
const result = trimSpaces('  Hello World  ', { leading: false, trailing: true });
console.log(result); // '  Hello World'

Other packages similar to string-trim-spaces-only

Keywords

FAQs

Package last updated on 03 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc